Re: [GENERAL] Re: [HACKERS] getting at the actual int4 value of an abstime

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [GENERAL] Re: [HACKERS] getting at the actual int4 value of an abstime
Дата
Msg-id l03130300b3e06d36a29d@[147.233.159.109]
обсуждение исходный текст
Ответ на Re: [HACKERS] getting at the actual int4 value of an abstime  (jim@reptiles.org (Jim Mercer))
Список pgsql-general
At 16:33 +0300 on 18/08/1999, Jim Mercer wrote:


> i suspect this would be more efficient than date_part('epoch', timefield).

Yes, but if someday someone decides that dates should be represented in
another way, this will break, and date_part( 'epoch', timefield ) will
always return the seconds since epoch. Data encapsulation thingie.

> also, is there a reverse to this?
>
> ie.  how does one inject unix time_t data into an abstime field.

Into a datetime, simply use datetime( n ). To an abstime, add an abstime()
around the former. Don't try abstime( n ) - at least it doesn't work in 6.4.


> then i bring it in using: "COPY tb USING STDIN;"
>
> it would be nice if i could do a batch of:
> "INSERT INTO tb (time_t, data1, date2) VALUES (934931604, 'aa', 'bb');"

copy is more efficient that a bunch of inserts, mind you.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



В списке pgsql-general по дате отправления:

Предыдущее
От: jim@reptiles.org (Jim Mercer)
Дата:
Сообщение: Re: [HACKERS] getting at the actual int4 value of an abstime
Следующее
От: Bruce Tong
Дата:
Сообщение: CVS Import/Export